
import { _decorator, Component, Node, Graphics,RigidBody, RigidBody2D,PhysicsSystem2D,EPhysics2DDrawFlags } from 'cc';
const { ccclass, property } = _decorator;

/**
 * Predefined variables
 * Name = OutBox
 * DateTime = Mon Apr 18 2022 17:02:16 GMT+0800 (中国标准时间)
 * Author = xiaopang125
 * FileBasename = OutBox.ts
 * FileBasenameNoExtension = OutBox
 * URL = db://assets/OutBox.ts
 * ManualUrl = https://docs.cocos.com/creator/3.4/manual/zh/
 *
 */

@ccclass('OutBox')
export class OutBox extends Component {
    // [1]
    // dummy = '';

    // [2]
    // @property
    // serializableDummy = 0;

    start() {
        // [3]
        this.DrawOutBox();
        // this.getComponent(RigidBody2D).enabledContactListener = true;
    }

    DrawOutBox() {
        PhysicsSystem2D.instance.debugDrawFlags = EPhysics2DDrawFlags.Aabb |
    EPhysics2DDrawFlags.Pair |
    EPhysics2DDrawFlags.CenterOfMass |
    EPhysics2DDrawFlags.Joint |
    EPhysics2DDrawFlags.Shape;

        //上
        // 下
        const ctx = this.getComponent(Graphics);
        ctx.rect(-400, 0, 800, 10);
        // ctx.stroke();
        ctx.fillColor.fromHEX('#f8e8b0');
        ctx.fill();
        // 左
        // 右

    }

    // update (deltaTime: number) {
    //     // [4]
    // }
}

/**
 * [1] Class member could be defined like this.
 * [2] Use `property` decorator if your want the member to be serializable.
 * [3] Your initialization goes here.
 * [4] Your update function goes here.
 *
 * Learn more about scripting: https://docs.cocos.com/creator/3.4/manual/zh/scripting/
 * Learn more about CCClass: https://docs.cocos.com/creator/3.4/manual/zh/scripting/decorator.html
 * Learn more about life-cycle callbacks: https://docs.cocos.com/creator/3.4/manual/zh/scripting/life-cycle-callbacks.html
 */
